package com.repetition.repetition.norepetition;/**
 * @author wzj
 * @date 2020/4/28 10:44
 * @version 1.0
 */

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * auther wzj
 * date 2020/4/28 10:44
 *  内存缓存
 */
@Configuration
public class UrlCache {

    @Bean
    public Cache<String, Integer> getCache() {
        return CacheBuilder.newBuilder().expireAfterWrite(5L, TimeUnit.SECONDS).build();// 缓存有效期为5秒
    }
}
